<?php

use Faker\Factory as Faker;
use App\Models\ChannelRelayDay;
use App\Repositories\ChannelRelayDayRepository;

trait MakeChannelRelayDayTrait
{
    /**
     * Create fake instance of ChannelRelayDay and save it in database
     *
     * @param array $channelRelayDayFields
     * @return ChannelRelayDay
     */
    public function makeChannelRelayDay($channelRelayDayFields = [])
    {
        /** @var ChannelRelayDayRepository $channelRelayDayRepo */
        $channelRelayDayRepo = App::make(ChannelRelayDayRepository::class);
        $theme = $this->fakeChannelRelayDayData($channelRelayDayFields);
        return $channelRelayDayRepo->create($theme);
    }

    /**
     * Get fake instance of ChannelRelayDay
     *
     * @param array $channelRelayDayFields
     * @return ChannelRelayDay
     */
    public function fakeChannelRelayDay($channelRelayDayFields = [])
    {
        return new ChannelRelayDay($this->fakeChannelRelayDayData($channelRelayDayFields));
    }

    /**
     * Get fake data of ChannelRelayDay
     *
     * @param array $postFields
     * @return array
     */
    public function fakeChannelRelayDayData($channelRelayDayFields = [])
    {
        $fake = Faker::create();

        return array_merge([
            'channel_id' => $fake->randomDigitNotNull,
            'relay_date' => $fake->word,
            'relay_num' => $fake->randomDigitNotNull,
            'status' => $fake->randomDigitNotNull,
            'updated_at' => $fake->word,
            'created_at' => $fake->word
        ], $channelRelayDayFields);
    }
}
